/**
 * Created with IntelliJ IDEA.
 * User: zdc
 * Date: 12-11-18
 * Time: 下午10:25
 * To change this template use File | Settings | File Templates.
 */

(function(){
    fl.runScript(fl.configURI + "jsfl/core.jsfl");
    var d = dom();
    var its = $('lib').s().get();
    var l = lib();
    if(its.length < 1){
        alert('choose something!')
        return;
    }
    l.addNewItem($.config.itemTypes.mc, its[0].name.replace(/\.\w+?$/g, "") + "_btn");
//    l.addNewItem($.config.itemTypes.bmp, its[0].name.replace(/\.\w+?$/g, "") + "_btn");
    l.editItem();
    for(var i = 0; i < its.length; i++){
        if(i > 0){
            tl().convertToBlankKeyframes();
        }
        else{
            cur_layer().frames[0].actionScript = "stop();";
        }
        lib().addItemToDocument({ x: 0, y: 0 }, its[i].name);
    }
    d.exitEditMode();
})();